<?php
require_once 'demo/e_user.php';

class m_User extends e_User {	
	    	
    function __construct()
    {
        parent::__construct();
    }
	
    function login($username,$password){
        if(!trim($username) || !trim($password))return false;
        $param = array(
            'username'=>trim($username),
            'password'=>md5(trim($password).PWD_END_FIX)
        );
        return $this->select_one($param);		
    }

    function reg($username,$password,$email='',$mobile=''){
        if(!trim($username) || !trim($password))return false;
        $param = array(
            'username'=>trim($username),
            'password'=>md5(trim($password).PWD_END_FIX),
            'email'=>$email,
            'mobile'=>$mobile
        );

        return $this->insert($param);		
    }
        
    function exists($username){
        if(!trim($username))return false;
        $param = array(
            'username'=>trim($username)			
        );
        return $this->select_one($param) != null;		
    }
	
}
?>